// Place your Spring DSL code here
beans = {
    taskExecutor(org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor) {
        corePoolSize = 5
        maxPoolSize = 10
        queueCapacity = 5000
    }

    // index writer can index one instance at a time
    // so poolsize must set to 1
    indexTaskExecutor(org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor) {
        corePoolSize = 1
        maxPoolSize = 1
        queueCapacity = 50000
    }

    newResourceProcess(NewResourceProcess) { bean ->
        bean.scope = "prototype"
        fetchService = ref('fetchService')
    }

    fetchFeedProcess(FetchFeedProcess) { bean ->
        bean.scope = "prototype"
        fetchService = ref('fetchService')
        indexTaskExecutor = ref('indexTaskExecutor')
        sessionFactory = ref('sessionFactory')
    }

    removeEntryProcess(RemoveEntryProcess) { bean ->
        bean.scope = "prototype"
        indexService = ref('indexService')
    }

    indexProcess(IndexProcess) {bean ->
        bean.scope = "prototype"
        indexService = ref('indexService')
        nameEntityService = ref('nameEntityServiceOld')
        sessionFactory = ref('sessionFactory')
        transactionManager = ref('transactionManager')
    }
    
    nameEntityServiceOld(org.opendream.roti.service.NameEntityService) {
    
    }

    contextWrapper(ContextWrapper) {}

    groovyShellService(com.iterative.groovy.service.GroovyShellService) { bean ->
        bean.initMethod = 'initialize'
        bean.destroyMethod = 'destroy'
        socket = 6789
        launchAtStart = true
        bindings = [ctx:ref('contextWrapper'),
                    Entry: Entry,
                    Resource: Resource]
    }
}
